package day6;

import java.util.*;

//测试集合遍历
public class TestIterate {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        Set<String> set = new HashSet<>();
        Map<String,String> map = new HashMap();
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");
        System.out.println("标准for----------");
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
        System.out.println("增强for----------");
        for (String s : list) {
            System.out.println(s);
        }
        System.out.println("迭代器----------");
        Iterator iterator = list.iterator();
        while (iterator.hasNext()){
            String s = (String) iterator.next();
            System.out.println(s);
        }

    }
}
